$(function() {
	var token = localStorage.phone;
	$.ajax({
		url: 'https://newapp.icandrive.cn/api/mytest.php',
		dataType: 'json',
		type: 'post',
		data: {
			token: token
		},
		success: function(data) {
			if(data.status == 250) {
				layer.msg("请重新登录");
				setInterval(function() {
					window.location.href = "../login/log_in.html";
				}, 2000)
			}
			if(data.status == 200) {

				$(data.array[0]).each(function() {
					if(this.sign_type == 'one') {
						this.sign_type = "一费制";
					} else {
						this.sign_type = "计时制";
					}

					$("#school_name").html(this.school_name);
					$("#school_address").html(this.school_address);
					$("#school_man").html(this.school_man);
					$("#man_phone").html(this.man_phone);
					$("#type").html(this.sign_type);
					$("#school_place").html('￥' + this.sign_place);
					$("#time").html(this.create_time);
					$("#img").html(this.school_img2);

				});
			}
			if(data.status == 400) {
				layer.msg("加载失败")
			}
		},
		error: function() {
			layer.msg('系统繁忙', function() {
				history.go(0)
			}, 1000);
		}
	});

	$('#tell').click(function() {
		var phone = $("#man_phone").text();
		console.log(phone);
		window.location.href = 'tel:' + phone;
	});
});
